#include "player.h"

player::player()
{
    //保存pacman的移动图片
    pacman_start=new QMovie (":/picture/Pacman_right.gif");
    pacman_die=new QMovie (":/picture/Pacman_die.gif");
    pacman_down=new QMovie (":/picture/Pacman_down.gif");
    pacman_left=new QMovie (":/picture/Pacman_left.gif");
    pacman_right=new QMovie (":/picture/Pacman_right.gif");
    pacman_up=new QMovie (":/picture/Pacman_up.gif");

    //初始化pacman的位置和相应矩形
    p_x=10*50+10;
    p_y=10*50+10;
    p_rect.setWidth(30);
    p_rect.setHeight(30);
    p_rect.moveTo(p_x,p_y);

}

void player::setPosition(int x, int y)
{
    p_x=x;
    p_y=y;
    p_rect.moveTo(p_x,p_y);
}
